// DOM Ready
jQuery.fn.equalizeHeights = function() {var maxHeight = this.map(function(i,e) {return $(e).height(); }).get(); return this.height( Math.max.apply(this, maxHeight) ); };

var js = {
	init: function(){
		$("#menu-topo li").mouseenter(function(event) {
			$(this).find('.sub-menu').stop(true,true).slideDown();
		}).mouseleave(function(event) {
			$(this).find('.sub-menu').stop(true,true).slideUp();
		});
		
		$("#wpfc-calendar-wrapper").on('mouseenter', '.fc-event-mark', function(event) {
			$(this).find('.fc-day-content').stop(true,true).slideDown();
			$(this).mouseleave(function(event) {
				$(this).find('.fc-day-content').hide();
			});
		});
		
	},
	home: function(){

	},
	institucional: function(){

	},
	artigos: function(){

	},
	noticias: function(){

	},
	convenios: function(){

	},
	banco_de_imagens: function(){
		$(".fancybox").fancybox();
		$(".fboxtrigger").click(function(e){
			e.preventDefault();
			$(this).next(".fancyboximgs").find("a:first").trigger("click");
		});
	},
	eventos: function(){
		$('article:even').each(function(index, el) {
			var $articles = $(this).next().add(el);
			$articles.equalizeHeights();
		});
	}
}
$(function() {
	// SVG fallback
	// toddmotto.com/mastering-svg-use-for-a-retina-web-fallbacks-with-png-script#update
	if (!Modernizr.svg) {var imgs = document.getElementsByTagName('img'); for (var i = 0; i < imgs.length; i++) {if (/.*\.svg$/.test(imgs[i].src)) {imgs[i].src = imgs[i].src.slice(0, -3) + 'png'; } } }
	js.init();
});
